<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="./js/jquery.js"></script>
    <title>Document</title>
</head>
<body>
    <script>
        $(function(){
            function ajaxPromise(type,url) {
                var p = new Promise(function(resolve,reject) {
                    $.ajax({
                        type,
                        url,
                        data : {},
                        success : resolve
                    })
                })
                return p;
            }

            ajaxPromise('get','http://127.0.0.1:8080/')
            .then(function(res){
                console.log(res,1111);
                return ajaxPromise('get','http://127.0.0.1:8080/post')
            })
            .then(function(data) {
                console.log(data,2222);
                return ajaxPromise('get','http://127.0.0.1:8080/cate')
            })
            .then(function(val) {
                console.log(val,333);
            })
        })
    </script>
</body>
</html>